nasbackup: fix agent.log is cleaned when backup stopped vm#13641
nasbackup: fix agent.log is cleaned when backup stopped vm#13641weizhouapache wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes unintended truncation of the KVM agent log during NAS backups of stopped VMs by changing the qemu-img convert logging redirection to append rather than overwrite /var/log/cloudstack/agent/agent.log.
Changes:
- Append
qemu-img convertstdout to the agent log (>>) in the stopped-VM backup path to prevent log loss.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13641 +/- ##
============================================
- Coverage 19.65% 19.64% -0.01%
Complexity 19792 19792
============================================
Files 6368 6368
Lines 575107 575107
Branches 70370 70370
============================================
- Hits 113016 113008 -8
- Misses 449808 449813 +5
- Partials 12283 12286 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@blueorangutan package |
|
@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18603 |
winterhazel
left a comment
There was a problem hiding this comment.
Looks good (did not test).
| fi | ||
| output="$dest/$name.$volUuid.qcow2" | ||
| if ! qemu-img convert -O qcow2 "$disk" "$output" > "$logFile" 2> >(cat >&2); then | ||
| if ! qemu-img convert -O qcow2 "$disk" "$output" >> "$logFile" 2> >(cat >&2); then |
There was a problem hiding this comment.
there is a shell utility called logger does it make sense to use that instead?
There was a problem hiding this comment.
It might make, but I would prefer to go with the simpler solution for the 4.23 RC2 instead to prevent any accidental regressions.
If we change it to use the logger utility, it would make more sense to change the other 10 appends to $logFile in this file together.
Description
This PR fixes the issue that when backing up a stopped vm, agent.log is cleaned up and all previous logs disappear.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?